﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Threading;

namespace Hi_Baidu.Timer
{
    /// <summary>
    ///     提供了对于反馈用户心跳的超时计算与相关操作
    /// </summary>
    class UserHeartBreathTimeOutEvent : TimeOutEvent
    {
        /// <summary>
        ///     提供了用户心跳的超时计算与相关操作
        /// </summary>
        /// <param name="Key">唯一标示</param>
        /// <param name="Interval">触发间隔</param>
        /// <param name="TryCount">尝试次数</param>
        public UserHeartBreathTimeOutEvent(String Key, int Interval, int TryCount)
            : base(Key, Interval, TryCount)
        {
            this.OnTick += new EventHandler<EventArgs>(UserHeartBreathTimeOutEvent_OnTick);
            this.OnTryFull += new EventHandler<EventArgs>(UserHeartBreathTimeOutEvent_OnTryFull);
        }

        void UserHeartBreathTimeOutEvent_OnTryFull(object sender, EventArgs e)
        {
            //提示超时,然后退出
            System.Windows.Application.Current.Dispatcher.Invoke(DispatcherPriority.Background, new PUBLIC_DELEGATE(Globle.OnlyShowWindow));
            Environment.Exit(0);
        }

        void UserHeartBreathTimeOutEvent_OnTick(object sender, EventArgs e)
        {
            
        }

    }
}
